<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('结项审核申请新增')"/>
</head>
<body class="pear-container" onload="uploadFileName()">
<form class="layui-form" action=""  th:object="${FinishProject}">
	<h4 align="center" style="font-size: large">项目基本信息</h4><br>
	<div class="layui-card">
		<div class="layui-card-body">
							<div class="layui-form-item layui-hide">
								<label class="layui-form-label">id</label>
								<div class="layui-input-block">
									<input readonly   id="proId" type="text" th:value="*{id}" name="id" lay-verify="title"
										   autocomplete="off" class="layui-input">
								</div>
							</div>

							<div class="layui-form-item">
			                    <label class="layui-form-label">项目批准号</label>
			                    <div class="layui-input-inline">
			                        <input readonly   th:value="*{proNumber}" type="text" name="proNumber" autocomplete="off" placeholder="项目批准号" class="layui-input">
			                    </div>

								<label class="layui-form-label">承担单位</label>
								<div class="layui-input-inline">
									<input readonly   th:value="*{proDept}" type="text" name="proDept" autocomplete="off" placeholder="承担单位" class="layui-input">
								</div>

								<label class="layui-form-label">项目类别</label>
								<div class="layui-input-inline">
									<select  name="proType" th:field="*{proType}">
										<option value="0">新型智库项目</option>
										<option value="1">省级社科规划项目</option>
									</select>
								</div>

								<label class="layui-form-label">学科分类</label>
								<div class="layui-input-inline">
									<input readonly   th:value="*{proSubject}" type="text" name="proSubject" autocomplete="off" placeholder="学科分类" class="layui-input">
								</div>

			                </div>

							<div class="layui-form-item">
			                    <label class="layui-form-label">项目名称</label>
			                    <div class="layui-input-inline">
			                        <input readonly   th:value="*{proName}" type="text" name="proName" autocomplete="off" placeholder="项目名称" class="layui-input">
			                    </div>

								<label class="layui-form-label">主题词</label>
								<div class="layui-input-inline">
									<input readonly   th:value="*{proWords}" style="width: 600px" type="text" name="proWords" autocomplete="off" placeholder="多个主题词以，分隔" class="layui-input">
								</div>

			                </div>
									
											
							<div class="layui-form-item" >
								<label class="layui-form-label" style="width: 100px">预期成果形式</label>
								<div class="layui-input-inline">
									<input readonly    th:value="*{planType}" type="text" name="planType" autocomplete="off" placeholder="预期成果形式" class="layui-input">
								</div>

			                    <label class="layui-form-label" style="width: 100px">最终成果形式</label>
			                    <div class="layui-input-inline">
			                        <input readonly   th:value="*{actualType}" type="text" name="actualType" autocomplete="off" placeholder="最终成果形式" class="layui-input">
			                    </div>

								<label class="layui-form-label">结项种类</label>
								<div class="layui-input-inline">
									<select  name="finishType" th:field="*{finishType}">
										<option value="0">正常</option>
										<option value="1">提前</option>
										<option value="2">延期</option>
										<option value="3">免于鉴定</option>
										<option value="4">申请中止或撤销</option>
									</select>
								</div>
			                </div>

							<div class="layui-form-item">
			                    <label class="layui-form-label" style="width: 100px">计划完成时间</label>
			                    <div class="layui-input-inline">
			                        <input readonly   th:value="*{planDate}" type="text" name="planDate" autocomplete="off" placeholder="计划完成时间" class="layui-input datetime-input">
			                    </div>

								<label class="layui-form-label" style="width: 100px">实际完成时间</label>
								<div class="layui-input-inline">
									<input readonly   th:value="*{finishDate}" type="text" name="finishDate" autocomplete="off" placeholder="实际完成时间" class="layui-input datetime-input">
								</div>

								<label class="layui-form-label" style="width: 100px">申请鉴定时间</label>
								<div class="layui-input-inline">
									<input readonly   th:value="*{applyDate}" type="text" name="applyDate" autocomplete="off" placeholder="申请鉴定时间" class="layui-input datetime-input">
								</div>
			                </div>

							<div class="layui-form-item">
			                    <label class="layui-form-label">成果形态</label>
			                    <div class="layui-input-inline">
			                        <select  name="resType" th:field="*{resType}">
			                    		<option value="0">出版物</option>
			                    		<option value="1">打印稿</option>
										<option value="2">手稿或其他复印件</option>
										<option value="3">其它</option>
			                    	</select>
			                    </div>

								<label class="layui-form-label" style="width: 100px">成果字数(千)</label>
								<div class="layui-input-inline">
									<input readonly   th:value="*{resWords}" type="text" name="resWords" autocomplete="off" placeholder="成果字数(千)" class="layui-input">
								</div>

								<label class="layui-form-label" style="width: 100px">报送成果套数</label>
								<div class="layui-input-inline">
									<input readonly   th:value="*{resQuantity}" type="text" name="resQuantity" autocomplete="off" placeholder="报送成果套数" class="layui-input">
								</div>
			                </div>

							<div class="layui-form-item">
								<label class="layui-form-label" style="width: 100px">是否计划出版</label>
								<div class="layui-input-inline">
									<input readonly   th:value="*{publishIf}" type="text" name="publishIf" autocomplete="off" placeholder="是否计划出版" class="layui-input">
								</div>

			                    <label class="layui-form-label" style="width: 100px">出版时间和单位</label>
			                    <div class="layui-input-inline">
			                        <input readonly   th:value="*{publishDetail}" style="width: 600px" type="text" name="publishDetail" autocomplete="off" placeholder="出版时间和单位" class="layui-input">
			                    </div>
			                </div>

							<div class="layui-form-item">
			                    <label class="layui-form-label">获奖情况</label>
			                    <div class="layui-input-block">
			                        <input readonly   th:value="*{proReward}" type="text" name="proReward" autocomplete="off" placeholder="获奖情况" class="layui-input">
			                    </div>
			                </div>

							<div class="layui-form-item">
			                    <label class="layui-form-label" style="width: 100px">转摘、引用情况</label>
			                    <div class="layui-input-inline">
			                        <input readonly   th:value="*{proUsage}" style="width: 1100px" type="text" name="proUsage" autocomplete="off" placeholder="转摘、引用情况" class="layui-input">
			                    </div>
			                </div>
		</div>
	</div>

	<h4 align="center" style="font-size: large">项目负责人基本信息</h4><br>
	<div class="layui-card">
		<div class="layui-card-body">
							<div class="layui-form-item">
			                    <label class="layui-form-label">姓名</label>
			                    <div class="layui-input-inline">
			                        <input readonly   th:value="*{manName}" type="text" name="manName" autocomplete="off" placeholder="姓名" class="layui-input">
			                    </div>

								<label class="layui-form-label">性别</label>
								<div class="layui-input-inline">
									<input readonly   th:value="*{manSex}" type="text" name="manSex" autocomplete="off" placeholder="性别" class="layui-input">
								</div>

								<label class="layui-form-label">民族</label>
								<div class="layui-input-inline">
									<input readonly   th:value="*{manNation}" type="text" name="manNation" autocomplete="off" placeholder="民族" class="layui-input">
								</div>

								<label class="layui-form-label">出生日期</label>
								<div class="layui-input-inline">
									<input readonly   th:value="*{manBirth}" type="text" name="manBirth" autocomplete="off" placeholder="出生日期" class="layui-input datetime-input">
								</div>
			                </div>

							<div class="layui-form-item">
			                    <label class="layui-form-label">所在单位</label>
			                    <div class="layui-input-inline">
			                        <input readonly   th:value="*{manDept}" type="text" name="manDept" autocomplete="off" placeholder="所在单位" class="layui-input">
			                    </div>

								<label class="layui-form-label">行政职务</label>
								<div class="layui-input-inline">
									<input readonly   th:value="*{manOffice}" type="text" name="manOffice" autocomplete="off" placeholder="行政职务" class="layui-input">
								</div>

								<label class="layui-form-label">专业职务</label>
								<div class="layui-input-inline">
									<input readonly   th:value="*{manTitle}" type="text" name="manTitle" autocomplete="off" placeholder="专业职务" class="layui-input">
								</div>
			                </div>
											
							<div class="layui-form-item">
			                    <label class="layui-form-label">研究专长</label>
			                    <div class="layui-input-inline">
			                        <input readonly   th:value="*{manExpertise}" type="text" name="manExpertise" autocomplete="off" placeholder="研究专长" class="layui-input">
			                    </div>

								<label class="layui-form-label">学历</label>
								<div class="layui-input-inline">
									<input readonly   th:value="*{manEducation}" type="text" name="manEducation" autocomplete="off" placeholder="学历" class="layui-input">
								</div>

								<label class="layui-form-label">学位</label>
								<div class="layui-input-inline">
									<input readonly   th:value="*{manDegree}" type="text" name="manDegree" autocomplete="off" placeholder="学位" class="layui-input">
								</div>
			                </div>

							<div class="layui-form-item">
			                    <label class="layui-form-label">通讯地址</label>
			                    <div class="layui-input-inline">
			                        <input readonly   th:value="*{manAddress}" type="text" name="manAddress" autocomplete="off" placeholder="通讯地址" class="layui-input">
			                    </div>

								<label class="layui-form-label">邮政编码</label>
								<div class="layui-input-inline">
									<input readonly   th:value="*{manZip}" type="text" name="manZip" autocomplete="off" placeholder="邮政编码" class="layui-input">
								</div>

			                </div>

							<div class="layui-form-item">
			                    <label class="layui-form-label">联系电话</label>
			                    <div class="layui-input-inline">
			                        <input readonly   th:value="*{manPhone}" type="text" name="manPhone" autocomplete="off" placeholder="联系电话" class="layui-input">
			                    </div>

								<label class="layui-form-label">邮箱</label>
								<div class="layui-input-inline">
									<input readonly   th:value="*{manEmail}" type="text" name="manEmail" autocomplete="off" placeholder="邮箱" class="layui-input">
								</div>
			                </div>
		</div>
	</div>

	<h4 align="center" style="font-size: large">课题主要参与者基本情况</h4><br>
	<div class="layui-card">
		<div class="layui-card-body">

			<table id="applyParticipator-table" lay-filter="applyParticipator-table"></table>

		</div>
	</div>

	<h4 align="center" style="font-size: large">总结报告</h4><br>
	<div class="layui-card">
		<div class="layui-card-body">

			<div class="layui-form-item layui-hide">
				<label class="layui-form-label"></label>
				<div class="layui-input-block">
					<input readonly   id="summaryReport" th:value="*{summaryReport}" type="text" name="summaryReport" class="layui-input">
				</div>
			</div>

			<div class="layui-upload" align="center">
<!--				<button type="button" class="layui-btn layui-btn-normal" id="summarySelect-btn">选择文件</button>-->
				<input readonly   class="layui-btn" style="display: none" id="summaryDisplay" >
<!--				<button type="button" class="layui-btn" id="summarySelect-upload">开始上传</button>-->
				<button id="summary-download" type="button" class="layui-btn">查看</button><br>
			</div>
		</div>
	</div>

	<h4 align="center" style="font-size: large">课题组的主要阶段性成果</h4><br>
	<div class="layui-card">
		<div class="layui-card-body">

			<table id="applyParticipator-table" lay-filter="applyParticipator-table"></table>

		</div>
	</div>

	<h4 align="center" style="font-size: large">项目最终成果简介</h4><br>
	<div class="layui-card">
		<div class="layui-card-body">

					<div class="layui-form-item layui-hide">
						<label class="layui-form-label"></label>
						<div class="layui-input-block">
							<input readonly   id="resContent" th:value="*{resContent}" type="text" name="resContent" class="layui-input">
						</div>
					</div>

					<div class="layui-upload" align="center">
<!--						<button type="button" class="layui-btn layui-btn-normal" id="resSelect-btn">选择文件</button>-->
						<input readonly   class="layui-btn" style="display: none" id="tt" >
<!--						<button type="button" class="layui-btn" id="resSelect-upload">开始上传</button>-->
						<button id="resContent-download" type="button" class="layui-btn">查看</button><br>
					</div>
		</div>
	</div>

	<h4 align="center" style="font-size: large">经费决算</h4><br>
	<h4 align="center" style="font-size: large">(项目研究经费不含项目鉴定费；项目初次鉴定费由省规划办统一支付，二次鉴定费由课题组承担)</h4><br>
	<div class="layui-card">
		<div class="layui-card-body">
							<div class="layui-form-item">
			                    <label class="layui-form-label" style="width: 150px">批准经费(万元)</label>
			                    <div class="layui-input-inline">
			                        <input readonly    th:value="*{costApprove}" type="text" name="costApprove" autocomplete="off" placeholder="批准经费(万元)" class="layui-input">
			                    </div>

								<label class="layui-form-label" style="width: 150px">配套经费(万元)</label>
								<div class="layui-input-inline">
									<input readonly   th:value="*{costMatch}" type="text" name="costMatch" autocomplete="off" placeholder="配套经费(万元)" class="layui-input">
								</div>
			                </div>

							<div class="layui-form-item">
			                    <label class="layui-form-label" style="width: 150px">资料费(细目)</label>
			                    <div class="layui-input-block">
			                        <input readonly   th:value="*{costMart}" style="width: 1000px" type="text" name="costMart" autocomplete="off" placeholder="资料费(细目)" class="layui-input">
			                    </div>
			                </div>
									
											
							<div class="layui-form-item">
			                    <label class="layui-form-label" style="width: 150px">调研超旅费(细目)</label>
			                    <div class="layui-input-block">
			                        <input readonly   th:value="*{costTraval}" style="width: 1000px" type="text" name="costTraval" autocomplete="off" placeholder="调研超旅费(细目)" class="layui-input">
			                    </div>
			                </div>
									
											
							<div class="layui-form-item">
			                    <label class="layui-form-label" style="width: 150px">会议费(细目)</label>
			                    <div class="layui-input-block">
			                        <input readonly   th:value="*{costConf}" style="width: 1000px" type="text" name="costConf" autocomplete="off" placeholder="会议费(细目)" class="layui-input">
			                    </div>
			                </div>
									
											
							<div class="layui-form-item">
			                    <label class="layui-form-label" style="width: 150px">设备购置和使用费(细目)</label>
			                    <div class="layui-input-block">
			                        <input readonly   th:value="*{costDevice}" style="width: 1000px" type="text" name="costDevice" autocomplete="off" placeholder="计算机及其辅助设备购置和使用费(细目)" class="layui-input">
			                    </div>
			                </div>
									
											
							<div class="layui-form-item">
			                    <label class="layui-form-label" style="width: 150px">印刷费(细目)</label>
			                    <div class="layui-input-block">
			                        <input readonly   th:value="*{costPrint}" style="width: 1000px" type="text" name="costPrint" autocomplete="off" placeholder="印刷费(细目)" class="layui-input">
			                    </div>
			                </div>
									
											
							<div class="layui-form-item">
			                    <label class="layui-form-label" style="width: 150px">专家咨询费(细目)</label>
			                    <div class="layui-input-block">
			                        <input readonly   th:value="*{costConsult}" style="width: 1000px" type="text" name="costConsult" autocomplete="off" placeholder="专家咨询费(细目)" class="layui-input">
			                    </div>
			                </div>
									
											
							<div class="layui-form-item">
			                    <label class="layui-form-label" style="width: 150px">其他费用(细目)</label>
			                    <div class="layui-input-block">
			                        <input readonly   th:value="*{costOther}" style="width: 1000px" type="text" name="costOther" autocomplete="off" placeholder="其他费用(细目)" class="layui-input">
			                    </div>
			                </div>
									
											
							<div class="layui-form-item">
			                    <label class="layui-form-label" style="width: 150px">项目结余经费</label>
			                    <div class="layui-input-block">
			                        <input readonly   th:value="*{costRemainder}" style="width: 1000px" type="text" name="costRemainder" autocomplete="off" placeholder="项目结余经费" class="layui-input">
			                    </div>
			                </div><br>

			<h4 align="center" style="font-size: medium">(为确保拨付预留经费的安全性和准确性，请务必填写您单位现在的账户)</h4><br>
							<div class="layui-form-item">
			                    <label class="layui-form-label">户名</label>
			                    <div class="layui-input-inline">
			                        <input readonly   th:value="*{costAccountName}" type="text" name="costAccountName" autocomplete="off" placeholder="户名" class="layui-input">
			                    </div>

								<label class="layui-form-label">开户行</label>
								<div class="layui-input-inline">
									<input readonly   th:value="*{costAccountAddress}" type="text" name="costAccountAddress" autocomplete="off" placeholder="开户行" class="layui-input">
								</div>

								<label class="layui-form-label">账号</label>
								<div class="layui-input-inline">
									<input readonly   th:value="*{costAccount}" style="width: 350px" type="text" name="costAccount" autocomplete="off" placeholder="账号" class="layui-input">
								</div>

			                </div>
		</div>
	</div>


<!--	<h4 align="center" style="font-size: large">所在单位审核意见</h4><br>-->
<!--	<div class="layui-card">-->
<!--		<div class="layui-card-body">-->
<!--							<div class="layui-form-item layui-hide">-->
<!--			                    <label class="layui-form-label">鉴定结果id</label>-->
<!--			                    <div class="layui-input-inline">-->
<!--			                        <input readonly   th:value="*{resId}" type="text" name="resId" autocomplete="off" placeholder="鉴定结果id" class="layui-input">-->
<!--			                    </div>-->
<!--			                </div>-->

<!--							<table id="applyParticipator-table" lay-filter="applyParticipator-table"></table>-->

<!--		</div>-->
<!--	</div>-->

<!--	<h4 align="center" style="font-size: large">省社科规划办审核审批意见</h4><br>-->
<!--	<div class="layui-card">-->
<!--		<div class="layui-card-body">-->
<!--							<div class="layui-form-item">-->
<!--			                    <div class="layui-input-block">-->
<!--			                        <input readonly   th:value="*{adviceSkl}" type="text" name="adviceSkl" autocomplete="off" placeholder="省社科规划办审核审批意见" class="layui-input">-->
<!--			                    </div>-->
<!--			                </div>-->
<!--		</div>-->
<!--	</div>-->

	<div class="layui-card">
		<div class="layui-card-body">
			<div class="layui-form-item">
				<label class="layui-form-label" style="width: 150px">是否申请免于鉴定</label>
				<div class="layui-input-block" >
					<input   disabled="true" type="radio" value="y"  lay-filter="applyAvoid" title="申请"  name="other2" class="layui-input"  />
					<input  disabled="true" type="radio" value="n"  checked="true" lay-filter="applyAvoid" title="不申请"  name="other2" class="layui-input" />
				</div>
			</div>

			<div id="avoidReasonItem">
				<h4 align="center" style="font-size: medium">申请免于鉴定理由</h4>
				<div class="layui-form-item">
					<div class="layui-input-block">
			<!--			<input readonly   th:value="*{avoidReason}" type="text" name="avoidReason" autocomplete="off" placeholder="申请免于鉴定理由" class="layui-input">-->
						<textarea th:utext="*{avoidReason}" id="avoidReason" name="avoidReason" style="display: none;"></textarea>
					</div>
				</div>
			</div>

			<div id="avoidExpertItem">
				<h4 align="center" style="font-size: large">建议回避鉴定的专家名单</h4>
				<table id="user-table" lay-filter="user-table"></table>
			</div>
		</div>
	</div>


	<h4 align="center" style="font-size: large">单位财务部门意见</h4><br>
	<div class="layui-card">
		<div class="layui-card-body">
	<div class="layui-form-item">
		<div class="layui-input-block">
<!--			<input  th:value="*{adviceInstFinance}" type="text" name="adviceInstFinance" autocomplete="off" placeholder="单位财务部门意见" class="layui-input">-->
			<textarea th:utext="*{adviceInstFinance}" id="adviceInstFinance" name="adviceInstFinance" style="display: none;"></textarea>
		</div>
	</div>
		</div>
	</div>


	<h4 align="center" style="font-size: large">单位审计部门意见</h4><br>
	<div class="layui-card">
		<div class="layui-card-body">
	<div class="layui-form-item">
		<div class="layui-input-block">
<!--			<input   th:value="*{adviceInstCheck}" type="text" name="adviceInstCheck" autocomplete="off" placeholder="单位审计部门意见" class="layui-input">-->
			<textarea th:utext="*{adviceInstCheck}" id="adviceInstCheck" name="adviceInstCheck" style="display: none;"></textarea>
		</div>
	</div>
		</div>
	</div>

	<h4 align="center" style="font-size: large">所在单位审核意见</h4><br>
	<div class="layui-card">
		<div class="layui-card-body">
	<div class="layui-card">
		<div class="layui-card-body">

			<div class="layui-form-item">
				<div class="layui-input-block">
<!--					<input   th:value="*{adviceInst}" type="text" name="adviceInst" autocomplete="off" placeholder="所在单位审核意见" class="layui-input">-->
					<textarea th:utext="*{adviceInst}" id="adviceInst" name="adviceInst" style="display: none;"></textarea>
				</div>
			</div>

		</div>
	</div>
		</div>
	</div>
	<br><br><br>

    <div class="bottom" style="position: fixed;bottom: 0">
        <div class="button-container">
			<button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit="" lay-filter="FinishProject-save">
				<i class="layui-icon layui-icon-ok"></i>
				保存
			</button>
			<button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit="" lay-filter="FinishProject-pass">
				<i class="layui-icon layui-icon-ok"></i>
				审核通过
			</button>
			<button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit="" lay-filter="FinishProject-noPass">
				<i class="layui-icon layui-icon-ok"></i>
				审核不通过
			</button>
        </div>
    </div>
</form>

<script type="text/html" id="avodiExpert-bar" >
	<button type="button" shiro:hasPermission="gen:finishSatgeResult:remove" class="pear-btn pear-btn-primary pear-btn-sm" lay-event="select" title="选择专家">选择专家
	</button>
	<button type="button" shiro:hasPermission="gen:finishProject:remove" class="pear-btn pear-btn-danger pear-btn-md" lay-event="batchRemoveAvoid">
		<i class="layui-icon layui-icon-delete"></i>
		删除
	</button>
</script>

<script>
	//显示当前已上传的文件名
	uploadFileName = function (){
		//总结报告
		$("#summaryDisplay").show();
		var path = $("#uploadSummary").val();
		var index = path.lastIndexOf("/");
		var fileName = path.substring(index+1,path.length);
		$("#summaryDisplay").val(fileName);
		//项目最终成果
		$("#tt").show();
		var path2 = $("#proResUpload").val();
		var index2 = path2.lastIndexOf("/");
		var fileName2 = path2.substring(index2+1,path2.length);
		$("#tt").val(fileName2);
	}
</script>

<th:block th:include="include :: footer"/>
<script>
    layui.use(['form','laydate','upload','jquery','layedit','table'], function () {
        let form = layui.form;
        let $ = layui.jquery;
        let MODULE_PATH = rootPath+"/FinishProjectController";
		let table = layui.table;

		let FILE_PATH = rootPath+"/oss";
        let upload = layui.upload;
        let BucketName='[[${BucketName}]]';
		var laydate = layui.laydate;
		var layedit=layui.layedit;


		//配置申请免鉴理由的富文本编辑器
		var layeditAvoidReason=layedit.build('avoidReason',
				{
					tool: [
						// 'strong' //加粗
						// ,'italic' //斜体
						// ,'underline' //下划线
						// ,'del' //删除线
						//
						// ,'|' //分割线

						,'left' //左对齐
						,'center' //居中对齐
						,'right' //右对齐
					]
				}); //建立编辑器

		//配置单位财务部门的富文本编辑器
		var layeditadviceInstFinance=layedit.build('adviceInstFinance',
				{
					tool: [
						// 'strong' //加粗
						// ,'italic' //斜体
						// ,'underline' //下划线
						// ,'del' //删除线
						//
						// ,'|' //分割线

						,'left' //左对齐
						,'center' //居中对齐
						,'right' //右对齐
					]
				}); //建立编辑器

		//配置单位审计部门的富文本编辑器
		var layeditadviceInstCheck = layedit.build('adviceInstCheck',
				{
					tool: [
						// 'strong' //加粗
						// ,'italic' //斜体
						// ,'underline' //下划线
						// ,'del' //删除线
						//
						// ,'|' //分割线

						,'left' //左对齐
						,'center' //居中对齐
						,'right' //右对齐
					]
				}); //建立编辑器

		//配置单位审核意见的富文本编辑器
		var layeditadviceInst=layedit.build('adviceInst',
				{
					tool: [
						// 'strong' //加粗
						// ,'italic' //斜体
						// ,'underline' //下划线
						// ,'del' //删除线
						//
						// ,'|' //分割线

						,'left' //左对齐
						,'center' //居中对齐
						,'right' //右对齐
					]
				}); //建立编辑器

		//默认勾选不申请免于鉴定
		$("#avoidExpertItem").show();
		$("#avoidReasonItem").hide();

		//配置radio按钮的样式切换
		form.on("radio(applyAvoid)",function (){
			if(this.value == 'y'){
				$("#avoidExpertItem").hide();
				$("#avoidReasonItem").show();
			}else if(this.value == 'n'){
				$("#avoidExpertItem").show();
				$("#avoidReasonItem").hide();
			}
		});

		//回避专家table
		let avoidExpertCols = [
			[
				{type: 'checkbox'},
				{title: '序号', type: 'numbers'},
				{title: '姓名', field: 'nickname', align: 'center'},
				{title: '单位名称', field: 'depName', align: 'center'},
				{title: '专业职称', field: 'userTitle', align: 'center'},
				// {title: '学历', field: 'userEducation', align: 'center'},
				// {title: '学位', field: 'userAcademicDegree', align: 'center'},
				{title: '研究专长', field: 'userExpertise', align: 'center'},
				{title: '回避理由', field: 'username', align: 'center'},
			]
		]

		//建议回避专家table表单列表
		table.render({
			elem: '#user-table',
			url: rootPath+"/ExpertController"+ '/listAvoid',
			page: true,
			method: 'get',
			cols: avoidExpertCols,
			skin: 'line',
			toolbar: '#avodiExpert-bar',
			defaultToolbar: [{
				layEvent: 'refreshAvoid',
				icon: 'layui-icon-refresh',}]
		});

		//建议回避专家工具栏绑定
		table.on('toolbar(user-table)', function (obj) {
			if (obj.event === 'select') {
				window.select(obj);
			} else if (obj.event === 'refreshAvoid') {
				window.refreshAvoid();
			}else if (obj.event === 'batchRemoveAvoid') {
				window.batchRemoveAvoid(obj);
			}
		});

		//批量删除
		window.batchRemoveAvoid = function (obj) {
			let data = table.checkStatus(obj.config.id).data;
			if (data.length === 0) {
				layer.msg("未选中数据", {icon: 3, time: 1000});
				return false;
			}
			let ids = "";
			for (let i = 0; i < data.length; i++) {
				ids += data[i].id + ",";
			}
			ids = ids.substr(0, ids.length - 1);
			layer.confirm('确定要删除这些数据', {icon: 3, title: '提示'}, function (index) {
				layer.close(index);
				let loading = layer.load();
				$.ajax({
					url: rootPath+"/ExpertController/"+ "removeAvoid?ids=" + ids,
					dataType: 'json',
					type: 'delete',
					success: function (result) {
						layer.close(loading);
						if (result.code==200) {
							layer.msg(result.msg, {icon: 1, time: 1000}, function () {
								table.reload('user-table');
							});
						} else {
							layer.msg(result.msg, {icon: 2, time: 1000});
						}
					}
				})
			});
		}

		//刷新按钮
		window.refreshAvoid = function () {
			table.reload('user-table');
		};

		//选择按钮
		window.select = function (obj) {
			layer.open({
				type: 2,
				title: '查看',
				shade: 0.1,
				area: ['800px', '600px'],
				content: rootPath+"/ExpertController/" + 'avoid'
			});
		}


        //同时绑定多个
        lay('.datetime-input').each(function(){
          laydate.render({
            elem: this
            ,trigger: 'click'
            ,type: 'datetime'
          });
        });

        //总结报告下载demo
		// $("#summary-download").click(function(){
		// 	var filePath = $("#summaryReport").val();
		// 	var index=filePath.lastIndexOf("/");
		// 	var fileName = filePath.substring(index+1,filePath.length);
		// 	console.log(filePath);
		// 	console.log(fileName);
		// 	window.open("/FileUploadController/downloadTwo?fileName="+encodeURI(fileName)+"&downUrl="+filePath);
		// 	return ;
		// });



		//总结报告成果简介（type=1）
		upload.render({
			elem: '#summarySelect-btn'
			, url: "/FileUploadController/edit/fileImp1/"+$("#proId").val()+'/'+1
			, auto: false
			//,multiple: true
			,accept: 'file'
			, bindAction: '#summarySelect-upload'
			, choose: function (obj) {
				// var file = this.files = obj.pushFile();
				obj.preview(function (index, file, result) {
					document.getElementById("summaryDisplay").style.display = "inline";
					var xx = document.getElementById("summaryDisplay").value = file.name+'【'+(file.size / 1024 / 1024).toFixed(2) + 'MB'+'】';
					// $("#demo1").attr('style','width:300px;heigth:400px');
					// $("#demo1").attr('src',result);

				})

			}
			, done: function (res) {
				if(res.code==0){

					return layer.msg('上传失败-------');
				}else {
					return  layer.msg('上传成功-------');
				}
			}
		});

		//项目最终成果简介（type=2）
		upload.render({
			elem: '#resSelect-btn'
			, url: "/FileUploadController/edit/fileImp1/"+$("#proId").val()+'/'+2
			, auto: false
			//,multiple: true
			,accept: 'file'
			, bindAction: '#resSelect-upload'
			, choose: function (obj) {
				// var file = this.files = obj.pushFile();
				obj.preview(function (index, file, result) {
					document.getElementById("tt").style.display = "inline";
					var xx = document.getElementById("tt").value = file.name+'【'+(file.size / 1024 / 1024).toFixed(2) + 'MB'+'】';
					// $("#demo1").attr('style','width:300px;heigth:400px');
					// $("#demo1").attr('src',result);

				})

			}
			, done: function (res) {
				if(res.code==0){

					return layer.msg('上传失败-------');
				}else {
					return  layer.msg('上传成功-------');
				}
			}
		});

		//保存
		form.on('submit(FinishProject-save)', function (data) {
			let loader = layer.load();
			data.field.adviceInstFinance = layedit.getContent(layeditadviceInstFinance);
			data.field.adviceInstCheck = layedit.getContent(layeditadviceInstCheck);
			data.field.adviceInst = layedit.getContent(layeditadviceInst);
			$.ajax({
				url: MODULE_PATH+'/edit',
				data: data.field,
				dataType: 'json',
				contentType: 'application/x-www-form-urlencoded',
				type: 'post',
				success: function (result) {
					if (result.code==200) {
						layer.msg(result.msg, {icon: 1, time: 1000}, function () {
							parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
							parent.layui.table.reload("applyProject-table");
							layer.close(loader);
						});
					} else {
						layer.msg(result.msg, {icon: 2, time: 1000});
						layer.close(loader);
					}
				}
			})
			return false;
		});

		//审核通过
		form.on('submit(FinishProject-pass)', function (data) {
			let loader = layer.load();
			data.field.adviceInstFinance = layedit.getContent(layeditadviceInstFinance);
			data.field.adviceInstCheck = layedit.getContent(layeditadviceInstCheck);
			data.field.adviceInst = layedit.getContent(layeditadviceInst);
			//单位审核通过
			data.field.deptPass = 1;
			//社科联审核状态为待审核
			data.field.sklPass = 0;
			$.ajax({
				url: MODULE_PATH+'/edit',
				data: data.field,
				dataType: 'json',
				contentType: 'application/x-www-form-urlencoded',
				type: 'post',
				success: function (result) {
					if (result.code==200) {
						layer.msg(result.msg, {icon: 1, time: 1000}, function () {
							parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
							parent.layui.table.reload("applyProject-table");
							layer.close(loader);
						});
					} else {
						layer.msg(result.msg, {icon: 2, time: 1000});
						layer.close(loader);
					}
				}
			})
			return false;
		});

		//审核不通过
		form.on('submit(FinishProject-noPass)', function (data) {
			let loader = layer.load();
			data.field.adviceInstFinance = layedit.getContent(layeditadviceInstFinance);
			data.field.adviceInstCheck = layedit.getContent(layeditadviceInstCheck);
			data.field.adviceInst = layedit.getContent(layeditadviceInst);
			//单位审核不通过
			data.field.deptPass = 2;
			//项目状态为审核不通过
			data.field.proState = 2;
			$.ajax({
				url: MODULE_PATH+'/edit',
				data: data.field,
				dataType: 'json',
				contentType: 'application/x-www-form-urlencoded',
				type: 'post',
				success: function (result) {
					if (result.code==200) {
						layer.msg(result.msg, {icon: 1, time: 1000}, function () {
							parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
							parent.layui.table.reload("applyProject-table");
							layer.close(loader);
						});
					} else {
						layer.msg(result.msg, {icon: 2, time: 1000});
						layer.close(loader);
					}
				}
			})
			return false;
		});
    })
</script>
</body>
</html>